package iblink.junit;

import java.util.Date;

import iblink.core.Option;
import iblink.core.Stock;
import iblink.util.Constants.Right;

import org.junit.Assert;
import org.junit.Test;

import packutil.DateUtil;

public class TestBasic extends Assert {

	@Test
	public void testStockEquality() {
		Stock stock1 = new Stock("AAPL", null, null, null, null, null);
		Stock stock2 = new Stock("AAPL", null, null, null, null, null);
		assertTrue(stock1.equals(stock2));
	}

	@Test
	public void testOptionEquality() {

		Stock stock1 = new Stock("AAPL", null, null, null, null, null);
		Stock stock2 = new Stock("AAPL", null, null, null, null, null);
		Date date1 = DateUtil.parseDate("09-24-1983", "MM-dd-yyyy");
		Date date2 = DateUtil.parseDate("09-24-1983", "MM-dd-yyyy");

		Option option1 = new Option(stock1, "AAPL092483C10000", Right.CALL,
				100d, date1);
		Option option2 = new Option(stock2, "AAPL092483C10000", Right.CALL,
				100d, date2);
		Option option3 = new Option(stock2, "AAPL092483C10500", Right.CALL,
				105d, date2);

		assertTrue(option1.equals(option2));
		assertFalse(option1.equals(option3));
	}
}
